package proyectos.cibertec.web.action;

import java.util.Map;
import java.util.TreeMap;

import javax.annotation.PostConstruct;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import proyectos.cibertec.web.util.GuestPreferences;

@Scope("session")
@Controller("themeSwitcherBean")
public class ThemeSwitcherBean {

	private Map<String, String> themes;

	private String theme;

	private GuestPreferences gp;

	public void setGp(GuestPreferences gp) {
		this.gp = gp;
	}

	public Map<String, String> getThemes() {
		return themes;
	}

	public String getTheme() {
		return theme;
	}

	public void setTheme(String theme) {
		this.theme = theme;
	}

	public ThemeSwitcherBean() {
		gp = new GuestPreferences();
	}

	@PostConstruct
	public void init() {
		theme = gp.getTheme();

		themes = new TreeMap<String, String>();
		themes.put("Aristo", "aristo");
		themes.put("Blitzer", "blitzer");
		themes.put("Dark-Hive", "dark-hive");
		themes.put("Home", "home");
	}

	public void saveTheme() {
		gp.setTheme(theme);
	}

}